package com.hr.mapper;

import com.hr.domain.dto.HouseFacilityDTO;
import com.hr.domain.po.HouseFacility;
import com.hr.domain.query.HouseFacilityPageParams;
import com.hr.domain.vo.HouseFacilityVO;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

/**
* @author 86150
* @description 针对表【house_facility(房源配套设施表)】的数据库操作Mapper
* @createDate 2025-09-24 09:35:56
* @Entity com.hr.domain.po.HouseFacility
*/
@Mapper
public interface HouseFacilityMapper {

    /**
     * 获取房源配套设施列表
     * @return houseFacilityList
     */
    @Select("SELECT * FROM house_facility")
    List<HouseFacilityVO> getHouseFacilityList();

    /**
     * 分页获取房屋配套设施列表
     * @param queryParams
     * @return houseFacilityPageResult
     */
    List<HouseFacilityVO> getHouseFacilityPageList(HouseFacilityPageParams queryParams);

    /**
     * 获取房屋配套设施类型
     * @return houseFacilityTypeList
     */
    @Select("select facility_type from house_facility")
    List<String> getHouseFacilityType();

    /**
     * 添加房屋配套设施
     * @param houseFacility
     * @return
     */
    @Insert("insert into house_facility(house_id, facility_type, name,distance) " +
            "values(#{houseId}, #{facilityType}, #{name},#{distance})")
    int addHouseFacility(HouseFacility houseFacility);

    /**
     * 删除房屋配套设施
     * @param id
     * @return
     */
    @Delete("delete from house_facility where id = #{id}")
    int deleteHouseFacility(@Param("id") Integer id);

    /**
     * 获取单个设施信息
     * @param id
     * @return houseFacility
     */
    @Select("select * from house_facility where id = #{id}")
    HouseFacilityVO getHouseFacility(Integer id);

    /**
     * 修改设施信息
     * @param houseFacilitydto
     * @return
     */
    @Update("update house_facility set house_id = #{houseId}, facility_type = #{facilityType}, name = #{name}, distance = #{distance} where id = #{id}")
    int updateHouseFacility(HouseFacilityDTO houseFacilitydto);

    /**
     * 批量删除设施信息
     * @param ids
     * @return
     */
    int deleteHouseFacilityBatch(@Param("ids") List<Integer> ids);
    /**
     * 获取设施id
     * @param id
     * @return houseFacilityId
     */
    @Select("select id from house_facility where house_id = #{houseId}")
    List<Integer> getHouseFacilityId(Long id);

    /**
     * 获取设施列表
     * @param houseId
     * @return houseFacilityList
     */
    @Select("select * from house_facility where house_id = #{houseId}")
    List<HouseFacility> getHouseFacilityListById(Long houseId);
}




